//FIGURE I - EFFECTS ON ABSENTEEISM
use attendance, clear
#delimit ;
graph twoway 
(lpolyci absent dist if rel_days>=-7 & rel_days<=-1, bwidth(.075) pwidth(1.125) clcolor(navy) clwidth(medthick) acolor(blue%15) alwidth(none)) 
(lpolyci absent dist if rel_days>=0 & rel_days<=7, bwidth(.075) pwidth(1.125) clcolor(maroon) clwidth(medthick) acolor(red%15) alwidth(none));
#delimit cr

#delimit ;
graph twoway 
(lpolyci res_absent rel_days if rel_days>=-10 & rel_days<=-1 & dist<=.5, bwidth(1) pwidth(1.5) n(20) clcolor(navy) clwidth(medthick) acolor(blue%15) alwidth(none)) 
(lpolyci res_absent rel_days if rel_days>=0 & rel_days<=10 & dist<=.5, bwidth(1) pwidth(1.5) n(20) clcolor(navy) clwidth(medthick) acolor(blue%15) alwidth(none)) 
(lpolyci res_absent rel_days if rel_days>=-10 & rel_days<=-1 & dist>.5, bwidth(1) pwidth(1.5) n(20)  clcolor(maroon) clwidth(medthick) acolor(red%15) alwidth(none)) 
(lpolyci res_absent rel_days if rel_days>=0 & rel_days<=10 & dist>.5, bwidth(1) pwidth(1.5) n(20)  clcolor(maroon) clwidth(medthick) acolor(red%15) alwidth(none));
#delimit cr


//FIGURE II - EFFECTS ON GPA
use gpa_semester, clear
reghdfe gpa treat_semester93-treat_semester98 treat_semester100-treat_semester107, absorb(geoid_blkgrp#semester mystd_id cohort#year) cluster(match_zip)


//FIGURE III - EFFECTS ON EMOTIONAL DISTURBANCE
use ed_semester, clear
reghdfe ed treat_semester93-treat_semester98 treat_semester100-treat_semester107, absorb(geoid_blkgrp#semester mystd_id cohort#year) cluster(match_zip)


//FIGURE IV - EFFECTS ON GPA BY RACE
use gpa_semester, clear
foreach race in black hispanic whiteasian {
	reghdfe gpa treat_post if std_`race', absorb(geoid_blkgrp#semester mystd_id cohort#year) cluster(match_zip)
	reghdfe gpa treat_post if sht_`race', absorb(geoid_blkgrp#semester mystd_id cohort#year) cluster(match_zip)
}


//FIGURE V - EFFECTS ON GPA BY WEAPON TYPE
use gpa_semester_DA, clear
reghdfe gpa tp_none tp_knife tp_gun, absorb(geoid_blkgrp#semester mystd_id cohort#year) cluster(match_zip)
reghdfe gpa tp_none tp_knife tp_gun if sht_black | sht_hispanic, absorb(geoid_blkgrp#semester mystd_id cohort#year) cluster(match_zip)


//FIGURE VI - COMPARING GPA EFFECTS OF POLICE AND CRIMINAL KILLINGS
use gpa_violence, clear
reghdfe gpa police_lead3-police_lead1 police_lag0-police_lag3 criminal_lead3-criminal_lead1 criminal_lag0-criminal_lag3 arrests crimes, absorb(geoid_blkgrp#semester mystd_id cohort#year) cluster(match_zip)


//FIGURE VII - EFFECTS ON EDUCATIONAL ATTAINMENT
use longrun, clear
local controls = "school treat expected_grade cst_level poverty parent_edu male home_english black hispanic asian other male" 

foreach y in gpa_cum graduate college {
	local m = cond("`y'"=="college", 2, 1)
	reghdfe `y' ib13.t_expected if sample`m' & n_grade<=1, absorb(cohort#geoid_blkgrp `controls') cluster(mystd_id)
}

